class CursoType {
  static arrow := 'ARROW'
  static sizeNWSE := 'SIZENWSE'
  static sizeNESW := 'SIZENESW'
  static sizeWE := 'SIZEWE'
  static sizeNS := 'SIZENS'
  static sizeAll := 'SIZEALL'
}

SetCursor(cursor) {
  static init := 0
  static table := Map()
  static ID := Map("ARROW", 32512, "SIZENWSE", 32642, "SIZENESW", 32643
    , "SIZEWE", 32644
    , "SIZENS", 32645
    , "SIZEALL", 32646)
  if !init {
    init := 1
    OnExit((*) => SetCursor(A_Cursor))
    For k, v in ID {
      table[k] := DllCall("CopyImage", "Ptr", DllCall("LoadCursor", "Ptr", 0, "Ptr", v, "Ptr")
        , "int", 2, "int", 0, "int", 0, "int", 0)
    }
  }
  if table.Has(cursor)
    DllCall("SetSystemCursor", "Ptr", DllCall("CopyImage", "Ptr", table[cursor]
      , "int", 2, "int", 0, "int", 0, "int", 0, "Ptr"), "int", 32512)
  else
    DllCall("SystemParametersInfo", "int", 0x57, "int", 0, "Ptr", 0, "int", 0)
}

; SetCursor(CursoType.arrow)